package com.itheima.demo02;

import java.io.*;

//字节缓冲流一个字节拷贝
public class ByteClass01 {
    public static void main(String[] args) {
        long start = System.currentTimeMillis();
        BufferedInputStream du = null;
        BufferedOutputStream xie = null;
        try {
            du = new BufferedInputStream(new FileInputStream("F:\\study\\就业班\\4.jpg"));
            xie = new BufferedOutputStream(new FileOutputStream("F:\\study\\雷切.jpg"));
            int b;
            while ((b = du.read()) != -1){
                xie.write(b);
            }
        } catch (IOException e) {
            e.printStackTrace();
        }finally {
            if (du != null) {
                try {
                    du.close();
                } catch (IOException e) {
                    e.printStackTrace();
                }
            }
            if (xie != null) {
                try {
                    xie.close();
                } catch (IOException e) {
                    e.printStackTrace();
                }
            }
        }
        long end = System.currentTimeMillis();
        System.out.println("程序运行了" + (end - start) + "毫秒！");
    }
}
